<?php
/**
 * @link https://ym2.cleverstone.top
 * @copyright Copyright (c) 2020 Yii Manager Software LLC
 */

namespace extend\weixin;

/**
 * this is WeChat applet service based interface.
 * @auther clevstn
 * @since 2.0
 * @datetime 2023.11.21 16:12
 */
abstract class BaseMiniRequest
{
    /**
     * @var bool Whether logged.
     */
    public $isLogged = true;

    /**
     * @return string The service name
     */
    abstract public function getServiceName();

    /**
     * The following options are supported.
     * - [getAsync] Asynchronous `get` method
     * - [postAsync] Asynchronous `post` method
     * - [putAsync] Asynchronous `put` method
     * - [patchAsync] Asynchronous `patch` method
     * - [deleteAsync] Asynchronous `delete` method
     * - [headAsync] Asynchronous `head` method
     * @return string
     */
    abstract public function getMethodAsync();

    /**
     * Get chain uri.
     * @return string
     */
    abstract public function getChain();

    /**
     * Get the request options to apply.
     * @return array Request options to apply.
     */
    abstract public function getRequestOptions();

    /**
     * @param \GuzzleHttp\Psr7\Response $response
     * @param WxMini $wxMini
     * @return callable This used to format response.
     */
    abstract public function responseCallback($response, WxMini $wxMini);
}